﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TaskInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   The priority.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.DataAccess.Test.Data_Entities
{
    using System;

    public enum Priority
    {
        High,
        Normal,
        Low
    }

    public enum Status
    {
        NotStarted,
        InProgress,
        Completed,
        Deferred,
        Waiting
    }

    /// <summary>
    /// Stores information about the user
    /// </summary>
    public class User
    {
        public int UserId
        {
            get;
            set;
        }

        public string UserName
        {
            get;
            set;
        }

        public string Email
        {
            get;
            set;
        }
    }

    /// <summary>
    /// The task info.
    /// </summary>
    public class TaskInfo : DataEntityBase
    {
        #region Properties

        private User taskOwner = new User();
        
        /// <summary>
        /// Gets or sets the task owner.
        /// </summary>
        /// <value>The task owner.</value>
        public User TaskOwner
        {
            get
            {
                return taskOwner;
            }
        }

        /// <summary>
        /// Gets or sets Priority.
        /// </summary>
        public Priority Priority
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets Status.
        /// </summary>
        public Status Status
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets Title.
        /// </summary>
        public string Title
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the due date.
        /// </summary>
        /// <value>The due date.</value>
        public DateTime DueDate
        {
            get;
            set;
        }

        public TaskInfo(Priority priority, Status status, string title, DateTime dueDate, string userName)
        {
            this.Priority = priority;
            this.Status = status;
            this.Title = title;
            this.DueDate = dueDate;
            this.TaskOwner.UserName = userName;
        }

        public TaskInfo()
        {
        }

        public static bool operator ==(TaskInfo task1, TaskInfo task2)
        {
            if(task1.Priority != task2.Priority)
                return false;
            if(task1.Status != task2.Status)
                return false;
            if(task2.Title != task2.Title)
                return false;

            return true;
        }

        public static bool operator !=(TaskInfo task1, TaskInfo task2)
        {
            return !(task1 == task2);
        }

        #endregion
    }
}